#ifndef prs_FrmScinPanel_H
#define prs_FrmScinPanel_H

#include "prs_FrmFunc.h"
#include "prs_FrmControl.h"
#include "prs_FrmDefTemplate.h"
#include "prs_FrmRules.h"
#include "prs_FrmGeom.h"
#include "prs_FrmPanelStyle.h"
#include "frm_control_TPanel.h"
#include "scin_panel.h"

namespace prs {

///////////////////////////////////////////////////////////////////////////////

struct TNodeFrmScinPanel : public TNodeFrmControl
{
  DECLARE_ClientNode()
  //
  typedef TNodeFrmPanelStyle TStyle;
  typedef ant::TScinPanel    TControl;
  //
  TAttrNodeType<nodeType_ScinPanel> NodeType;
  TAttrPointerNoCopy<attrName_Control,ant::TScinPanel*> Control;
  //
  TAttrBool<attrName_EnEdit> EnEdit;
  TAttrBool<attrName_UseGlobalKeywords> UseGlobalKeywords;
  TAttrString<attrName_Value> Value;
  TAttrInteger<attrName_CaretWidth> CaretWidth;
  //
  TNodeFrmScinPanel();
 ~TNodeFrmScinPanel() { delete Control.GetValue();}

private:
  svl_Except();
};

///////////////////////////////////////////////////////////////////////////////

struct TRuleFrmScinPanel : public snt::TRule
{
  TRuleFrmScinPanel(
    snt::text::TContext &Context,
    svl::TVariant &VParentNode,
    TRuleFrmChildrenBase &RChildren,
    TRuleSetNodeIdOptionally &RSetNodeIdOptionally,
    TRuleFrmGeom &RFrmGeom,
    TRuleSetAttrValue &RSetAttrValue,
    TRuleSetStyle &RStyle
  );

private:  
  TNodeFrmScinPanel *GetNode() { return dynamic_cast<TNodeFrmScinPanel*>(vParentNode.Pointer());}
  //
  void FSetGeometry(snt::TParams &Params) { rGeometry.SetGeom( &GetNode()->Geometry.Value );}
  //
  bool FSetParamS(TRuleSetAttrValue::TFuncValueIdentParams &Params) {
	  return TNodeDefTemplate::AddLinkAttrByParamId(Params.Attr,TFrmStringValue(),Params.Ident,Params.OutError);
  }
  bool FSetParamB(TRuleSetAttrValue::TFuncValueIdentParams &Params) {
	  return TNodeDefTemplate::AddLinkAttrByParamId(Params.Attr,TFrmBoolValue(),Params.Ident,Params.OutError);
  }
  bool FSetParamI(TRuleSetAttrValue::TFuncValueIdentParams &Params) {
	  return TNodeDefTemplate::AddLinkAttrByParamId(Params.Attr,TFrmIntegerValue(),Params.Ident,Params.OutError);
  }
  //
  svl::TVariant &vParentNode;
  TRuleFrmGeom &rGeometry;
  snt::TRule  RAttr,RAttr1;
  snt::TAlter AAttr1;
  svl_Except;
};

///////////////////////////////////////////////////////////////////////////////
}

#endif
